package com.coldchain.cys.api;

import com.coldchain.authclient.annotation.CheckUserToken;
import com.coldchain.common.msg.BaseResponse;
import com.coldchain.common.msg.ObjectRestResponse;
import com.coldchain.cys.entity.CarBrand;
import com.coldchain.cys.mapping.ApiUtils;
import com.coldchain.cys.page.CarBrandQueryVo;
import com.coldchain.cys.service.ICarBrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tianpeng
 * @since 2018-08-28
 */
@RestController
@CheckUserToken
@Api(description="车辆品牌管理")
public class CarBrandController {
	
	@Autowired
	private ICarBrandService carBrandService ;

	@ApiOperation(value="车辆品牌列表")
	@ApiImplicitParams(value={
			@ApiImplicitParam(name="current",value="页码",dataType="Integer",paramType="query"),
			@ApiImplicitParam(name="name",value="品牌名称模糊查询",dataType="String",paramType="query"),
	})
	@RequestMapping(value=ApiUtils.SHOW_CAR_BRAND_LIST,method= {RequestMethod.GET})
	public ObjectRestResponse<CarBrandQueryVo> showCarBrandList(CarBrandQueryVo vo){
		carBrandService.getList(vo) ;
		return new ObjectRestResponse<CarBrandQueryVo>(vo) ;
	}
	
	@ApiOperation(value="添加车辆品牌")
	@ApiImplicitParams(value={
			@ApiImplicitParam(name="name",value="品牌名称",dataType="String",paramType="query"),
	})
	@RequestMapping(value=ApiUtils.DO_ADD_CAR_BRAND,method= {RequestMethod.POST})
	public BaseResponse doAddCarBrand(CarBrand carBrand) {
		return carBrandService.doAddCarBrand(carBrand) ;
	}
}
